namespace Patterns4Net.PatternEnforcer.Cmd
{
    using System.Diagnostics.Contracts;
    using Patterns4Net.Attributes.DesignPatterns;

    [Immutable]
    public class Options
    {
        public Options()
        {
            this.Help = false;
        }

        public string ConfigFile { get; set; }

        public string OutputFormat { get; set; }

        public bool Help { get; set; }

        public bool HasConfigFile
        {
            get
            {
                Contract.Ensures(Contract.Result<bool>() != string.IsNullOrEmpty(this.ConfigFile));
                return string.IsNullOrEmpty(this.ConfigFile) == false;
            }
        }

        public override bool Equals(object obj)
        {
            if (obj == null || GetType() != obj.GetType())
            {
                return false;
            }

            var args = (Options)obj;
            return this.ConfigFile.Equals(args.ConfigFile) && this.OutputFormat.Equals(args.OutputFormat);
        }

        public override int GetHashCode()
        {
            return this.ConfigFile.GetHashCode() ^ this.OutputFormat.GetHashCode();
        }
    }
}
